This page last changed on Apr 27, 2006 by rossmason.

The Pop3 transport provider can be used to for receiving messages from POP3 inboxes and connecting to POP3 mailboxes using SSL (POP3s) using the javax.mail api.

The javadoc for this provider can be found here.

org.mule.providers.email.Pop3Connector.

Pop3 Connector Properties

Property Description Default Required
backupFolder This refers to a file system folder to backup consumed mail messages to. This is really only for audit purposes.   No
checkFrequency Determines how often the Pop3 mailbox is polled for new messages. the value is represented in milliseconds. 60000 Yes
authenticator Is used when setting up a Mail session. By default Mule handles authentication by creating a default Authenticator if there are user credentials set on the Pop3 endpoint (see below). Users can customise the authenticator if needed by setting this to their own authenticator implementation. Authenitcators must implement javax.mail.Authenticator   No
deleteReadMessages whether to delete messages once they have been read. Otherwise they are marked as SEEN. The bahaviour of different mail servers differs and on some mail servers setting the SEEN flag seems to have no effect. true No
Server Credentials

The host, port and user credentials as set on the pop3:// endpoint. If no port is specifed the default port will be used.

Pop3s Connector Properties

The Pop3s Connector enables Pop3 over SSL using the javax.mail APIs. It supports all the properties of the Pop3 connector and has some additional properties for setting up an SSL connection.

Property Description Default Required
socketFactory The SSL socket factory to use javax.net.ssl.SSLSocketFactory No
socketFactoryFallback Whether to enable fallback false No
trustStore The flie location of a trust store   No
trustStorePassword The password for the trust store   No

When using the Pop3s Connector the default port is set to 995.

Pop3(s) Endpoints

Pop3 endpoints describe details about the connecting to a Pop3 mailbox. Pop3 URIs use the following syntax -

pop3://<user:password>@<pop3 server>[:port][?params]

The format is the same for POP3s -

pop3s://<user:password>@<pop3 server>[:port][?params]
Escape your credentials

Sometimes you'll have illegal (for URI) characters in your login/password. Use the standard escape syntax your browser would use, e.g. the username user@mule would become user%40mule.

For example to connect to a Google gmail box you need to use POP3s,

pop3s://muletestbox:[email protected]?checkFrequency=30000

This will log into the muletestbox mailbox on pop.gmail.com using password 123456 (using default POP3s port) and will check the mailbox for new messages every 30 seconds.

To set additional properties on the endpoint, you can set them as parameters on the URI but we recommend you set them as endpoint properties to make it easier to read and maintain the configuration.

<endpoint address="pop3s://username:[email protected]">
    <properties>
        <property name="checkFrequency" value="120000"/>
        <property name="trustStore" value="./trustore"/>
        <property name="trustStorePassword" value="trustNoOne"/>
    </properties>
</endpoint>

Filters

Filters can be set on an endpoint to filter out any unwanted messages. The Mail transport provider has a couple of Email filters that can either be used directly or extended to implement custom filtering rules.

Filter Description
org.mule.providers.email.filters. AbstractMailFilter A base filter implementation that must be extended by any other mail filter.
org.mule.providers.email.filters. MailSubjectRegExFilter Will filter messages based on their subject matching a regex filter.

Configuring Filters

The following demonstrates to only accept messages where the email subject starts with [mule] -

<endpoint address="pop3s://username:[email protected]">
    <filter className="org.mule.providers.email.filters.MailSubjectRegExFilter"
        pattern="\\[mule\\](.*)"/>
    <properties>
        <property name="checkFrequency" value="120000"/>
        <property name="trustStore" value="./trustore"/>
        <property name="trustStorePassword" value="trustNoOne"/>
    </properties>
</endpoint>

Transformers

There are a couple of transformers provided with the Email transport that are useful for converting javax.mail.Message to Mule event payloads. These transformers will extract the message body and properties (including headers) and handle attachments too. If you need to customise the behaviour of these transformers it is recommended that you extends the existing transformers rather than re-implement them.

Transformer Description
org.mule.providers.email.transformers. EmailMessageToString Converts a javax.mail.Message to String message payload. This transformer doesn't support attachements and is deprecated in favour of the MimeMessageToObject transformer
Converting a MimeMessage to a UMOMessage The MessageAdapter for Pop3 is responsible for decomposing a MimeMessage to a UMOMessage. the first body part is used as the payload and all subsequent parts are added as attachments. The mimEMessage headers are added to the UMOMessage properties.
Document generated by Confluence on Nov 27, 2006 10:27